package com.fzy.core.action;

import java.util.Map;

import com.fzy.core.BaseAction;
import com.fzy.core.BaseService;
import com.fzy.core.MyValidationAware;
import com.opensymphony.xwork.ModelDriven;
import com.opensymphony.xwork.Preparable;

public class InputAction extends BaseAction implements ModelDriven,
		MyValidationAware, Preparable {

	private static final long serialVersionUID = -2042848465554272624L;
	Map entity;
	BaseService baseService;
	String errorDispatch;

	public void prepare() throws Exception {
		errorDispatch = "redirect:list.do";
		entity = validateId((String) getRequestParams().get("id"),
				getClassMapping());
	}

	public void validate() {
	}

	public String execute() throws Exception {
		entity.put("id", getRequestParams().get("id"));
		return "dispatcher:/WEB-INF/jsp/input.jsp";
	}

	public void setBaseService(BaseService baseService) {
		this.baseService = baseService;
	}

	public String getErrorDispatch() {
		return errorDispatch;
	}

	public Map getEntity() {
		return entity;
	}

	public void setEntity(Map entity) {
		this.entity = entity;
	}

	public Object getModel() {
		return entity;
	}

}
